package com.example.micro.netty.server.thread;

/**
 * @author Code Farmer
 * @create 2020/10/7 4:18 下午
 */
public class WaitNotifyDemo1 {

    public static Object object = new Object();
    private static int count = 0;

    public static class WaitThread extends Thread {
        @Override
        public void run() {
            synchronized (object) {
                try {
                    System.out.println(Thread.currentThread().getName() + ":" + count++);
                    object.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                } finally {
                    System.out.println("end");
                }
            }
        }
    }

    public static void main(String[] args) {
        new WaitThread().start();
    }

}
